package com.shinhye.wisdompeking;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.shinhye.wisdompeking.fragment.HomeFragment;
import com.shinhye.wisdompeking.fragment.MenuFragment;
import com.shinhye.wisdompeking.utils.FragUtils;

public class MainActivity extends FragmentActivity {

	private SlidingMenu slidingMenu;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.content);
		
		slidingMenu = (SlidingMenu) View.inflate(this, R.layout.slidingmenu, null);
		slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
		slidingMenu.setMenu(R.layout.menu_frame);
		
		init();
	}

	private void init() {
		FragUtils.addFragment(this, R.id.menu, new MenuFragment(), "MENU", false);
		FragUtils.addFragment(this, R.id.content_frame, new HomeFragment(), "HOME", false);
	}
	
	public SlidingMenu getMenu() {
		return slidingMenu;
	}
	
	public MenuFragment getMenuFragment() {
		return (MenuFragment) getSupportFragmentManager().findFragmentByTag("MENU");
	}

	public HomeFragment getHomeFragment() {
		return (HomeFragment) getSupportFragmentManager().findFragmentByTag("HOME");
	}
}
